Skip to content

fix(relinker): match needed module names that differ only in the extension - #1830

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
tv7:fix/relinker-needed-debug-prx
Oct 10, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
tv7:fix/relinker-needed-debug-prx

Conversation

@tv7

@tv7 tv7 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

What

Fixes items 1 and 5 of #1794 (traced in this comment).

A title's executable can name a bundled module differently from the file it ships. Dying Light 2 (PPSA02262) needs EOSSDK-PS5-Shipping.debug_prx and ships EOSSDK-PS5-Shipping.prx beside the executable. Needed names were matched by exact filename, so the relinker skipped the module without an error, and start-up stopped with Failed to load module: ...\libs\EOSSDK-PS5-Shipping.debug_prx. Renaming the file is not a workaround. The title later calls sceKernelLoadStartModule("/app0//EOSSDK-PS5-Shipping.prx"), and dlopen looks for app0/EOSSDK-PS5-Shipping.prx.guest.prx. That load fails with ENOENT, so the title's EOS lobby backend fails and CGame::Initialize asserts Net_StartUp failed.

GuestModuleBuilder now resolves a needed name that no file has exactly to a module whose name differs only in its .prx, .sprx or .debug_prx extension. This applies both in the module directories and in the search under the input. The output keeps the shipped file name (EOSSDK-PS5-Shipping.prx.guest.prx), so run-time loads by that name find it. The needed name is added as another name of that guest module, so the executable binds to it instead of asking for a host library. An exact filename still wins. Two candidates for one needed name are ambiguous, as for exact names.

Tested

Windows 11, MinGW GCC 15.2.0, RTX 3070:

  • guest_needed_modules has new cases. An executable needs needed.debug_prx while needed.prx is shipped, once in Media/Modules and once in sce_module/, on both the Linux and the Windows output. The guest output is needed.prx.guest.prx, the Linux executable's DT_NEEDED is that path and no host needed.debug_prx, and the Windows output runs and returns 42. needed.prx and needed.sprx side by side are reported as ambiguous. Without the change the new cases fail; with it they pass.
  • Full build and ctest: 479/479 pass.
  • python tools/check_conventions.py --base origin/main passes.
  • Dying Light 2: relinked without renaming anything, EOSSDK-PS5-Shipping.prx.guest.prx is produced, and with the title's logging enabled it reports [Lobby.Backend.Eos] > [StartUp] ok and [Lobby] > [Initialize] all backends are up. Net_StartUp passes. The title then stops in EOS's RtcNetworkThread, which is the socket descriptor / fd_set question raised in Dying Light 2 (PPSA02262) on Windows: what stops it between conversion and its own startup #1794 and is not part of this PR. Other Dying Light 2 (PPSA02262) on Windows: what stops it between conversion and its own startup #1794 items were worked around locally for this run.

Linux output is covered by the test; I did not run a title on Linux.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

🤖 Generated with Claude Code

@Rohan03x

Rohan03x commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Tested on Windows with a second title that hits the same failure as #1794 item 1.

Setup: Windows 11 22621, GCC 15.2.0 UCRT Release, this PR (cb571d3) merged onto main d70b899. Title: Palworld (PPSA23126, v01.102.999).

Case: the eboot's DT_NEEDED has EOSSDK-PS5-Shipping.debug_prx; the dump ships the module as prx/eossdk-ps5-shipping.prx (no DT_SONAME). The name differs in the extension and in case.

Result: with this PR the relinked app.exe is byte-identical to main's and still lists libs\EOSSDK-PS5-Shipping.debug_prx, so the app stops at start with Failed to load module, error 126. ModuleStem(path.filename().string()) == stem compares eossdk-ps5-shipping with EOSSDK-PS5-Shipping, so no alias is recorded. Relinker tests pass 36/36 with the PR.

Local variant: folding ASCII case in ModuleStem when windows is true (like the existing Windows-only filename fold) removes the slot, and the relinked app then gets past module loading on this host (it stops later on an unrelated missing import). Folding alone made windows_import_modules fail with Ambiguous guest dependency name: Party.prx, so an exact name has to win over a folded stem match in the alias loop. With that, 36/36 plus a new Foo-Bar.debug_prx / foo-bar.prx case. I can share the diff (+26 −7) if useful.

Limits: one title; the run only shows that module loading passes, not that the title boots. Dying Light 2 not tested. AI-assisted: yes.

tv7 and others added 2 commits October 10, 2026 00:24
…nsion

A title's executable can name a bundled module differently from the file it
ships: Dying Light 2 needs EOSSDK-PS5-Shipping.debug_prx and ships
EOSSDK-PS5-Shipping.prx. Needed names were matched by exact filename, so the
module was skipped without an error and start-up failed to load it. Renaming
the file does not help either: the title later loads the module at run time
by its shipped name (/app0//EOSSDK-PS5-Shipping.prx), and dlopen looks for
that name's .guest.prx (boykopovar#1794).

When no file has the needed name, a module whose name differs only in its
.prx, .sprx or .debug_prx extension now satisfies it, in the module
directories or elsewhere under the input. The output keeps the shipped file
name, and the needed name is added as another name of that guest module.
Two such candidates for one needed name are ambiguous, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Palworld's eboot needs EOSSDK-PS5-Shipping.debug_prx while the dump ships
prx/eossdk-ps5-shipping.prx. On Windows, compare module stems without
ASCII case, and let a name that already resolves to a guest image (exact
or case-folded filename, or soname) win over a stem alias.

Reported and diagnosed by @Rohan03x in boykopovar#1830.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tv7
tv7 force-pushed the fix/relinker-needed-debug-prx branch from cb571d3 to 0745d80 Compare October 9, 2026 21:29
@tv7

tv7 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

@Rohan03x thanks for the Palworld run and the diagnosis. I took your approach into the PR (0745d80, credited in the commit) rather than asking for the diff:

  • On Windows ModuleStem folds ASCII case, so EOSSDK-PS5-Shipping.debug_prx matches eossdk-ps5-shipping.prx.
  • A name that already resolves to a guest image wins over a stem alias: the first pass treats a case-folded filename match as found (the existing Windows findGuest fold handles it), and the alias loop skips names already in guestNames. That is what keeps windows_import_modules (Party.prx) passing.
  • guest_needed_modules gets a Windows case for Foo-Bar.debug_prx vs prx/foo-bar.prx that runs the relinked exe. It fails on the previous head with Failed to load module ... Foo-Bar.debug_prx, error 126 (same as your report), and passes now.

Also rebased onto current main (no conflicts). Full build + ctest 516/516 on Windows (GCC 15.2 UCRT); check_conventions.py passes. If you can rerun Palworld on this head, that would confirm it on a real title.

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#1815 core/relinker/relinker/src/guest/GuestModuleBuilder.cpp L75-76, L81-84

oneandonlydean added a commit to oneandonlydean/AnyPS5 that referenced this pull request Oct 10, 2026
oneandonlydean added a commit to oneandonlydean/AnyPS5 that referenced this pull request Oct 10, 2026
@oneandonlydean
oneandonlydean merged commit fdd2d26 into boykopovar:main Oct 10, 2026
7 checks passed
SleglJan pushed a commit to SleglJan/AnyPS5 that referenced this pull request Oct 10, 2026
…-prx

fix(relinker): match needed module names that differ only in the extension
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants